//会员管理编辑。
Ext.define("ES.view.membership.MembershipEdit",{
    extend:"Ext.window.Window",
    alias:"widget.membershipEdit",
    title:"会员管理",
    width:800,
    height:600,
    layout:"fit",
    modal:true,
    items:{
        xtype:"form",
        defaultType:"textfield",
        frame:true,
        layout:"column",
        buttonAlign:"center",
        defaults:{
            labelSeparator:":",
            labelWidth:52,//标签宽度。
            labelAlign:"right",
            allowBlank:false,//是否允许为空。
            blankText:"不允许为空",
            msgTarget:"side"
        },
        items:[{
            fieldLabel:"会员名称",
            name:"memberName",
            margin:"2 0 0 0",
            columnWidth:0.3
        },{
            fieldLabel:"会员帐号",
            name:"memberSign",
            margin:"2 0 0 6",
            columnWidth:0.4
        },{
            xtype:"radiogroup",
            fieldLabel:"会员状态",
            columns:2,
            vertical: false,
            items:[{boxLabel:"正常使用",name:"memberStatus",inputValue:"1",checked:true},
                       {boxLabel:"暂停使用",name:"memberStatus",inputValue:"0"}],
            margin:"2 0 0 6",
            columnWidth:0.3
        },{
            xtype:"treepanel",
            height:496,
            title:"科目信息",
            layout:"fit",
            store:"MembershipCatalogTreeStore",
            rootVisible:false,
            useArrows:true,
            lines:true,
            animate:true,
            frame:true,
            columns:[{
                    xtype:"treecolumn",
                    text:"科目名称",
                    flex:4,
                    dataIndex:"text"
            },{
                    xtype:"datecolumn",
                    format:"Y-m-d",
                    text:"创建时间",
                    flex:1,
                    dataIndex:"createTime",
                    editor:{
                        xtype:"datefield",
                        format:"Y-m-d",
                        allowBlank:false
                    }
            },{
                    text:"有效期限(月)",
                    flex:1,
                    dataIndex:"cycle", 
                    editor:{
                        xtype:"numberfield",
                        minValue:1,
                        value:1,
                        allowBlank:false
                    }
            }],
            selType:"rowmodel",
            plugins:{
                    ptype:"rowediting",
                    pluginId:"membershipEditRowediting",
                    clicksToEdit:2
            },
            listeners:{
                checkchange:function(node,checked,opts){
                    if(checked){
                        var obj = this.getPlugin("membershipEditRowediting");
                        if(obj){
                              obj.startEdit(node,0);
                        }
                    }
                }
            },
            columnWidth:1
        }],
        buttons:[{
               text:"保存",
               action:"btnSave",
               formBind:true,
               disabled:true,
               tooltip:"保存数据"
           },{
               text:"取消",
               action:"btnCancel",
               tooltip:"关闭窗口"
           }]
    },
    initComponent:function(){
        this.callParent(arguments);
    }
})